#ifndef __HIKARI_AnotherScript___FILE__DEFINED
#define __HIKARI_AnotherScript___FILE__DEFINED

#include "hikari.h"

class AnotherScript:public BaseHikariScript{
	int lastTime;
	int fps;
	int fixedFps;
	gui::IGUIStaticText*text;
public:
	AnotherScript(){
		fps=0;
		lastTime=0;
		fixedFps=0;
		text=NULL;
	}
//PLEASE DO NOT MODIFY THIS SECTION
//PROPERTIES_SECTION_START
//PROPERTIES_SECTION_END
	
	virtual void sceneLoaded(HObj*object, HikariContext*context){
		text=context->getDevice()->getGUIEnvironment()->addStaticText(L"0.0 fps", rect<s32>(10,10,100,100));

	}

	virtual void update(HObj*object, HikariContext*context){
		if(context->getInput()->IsKeyDown(irr::KEY_UP)){
			object->moveZ(0.5f);
		}
		if(context->getInput()->IsKeyDown(irr::KEY_DOWN)){
			object->moveZ(-0.5f);
		}
		object->turnY(context->getInput()->getMouseSpeedX()/2.0f);
		//context->getDevice()->getCursorControl()->setPosition(400,300);
		//context->getInput()->processMouseSpeed();
		if(context->getInput()->isLeftMouseButtonPressed()){
			Hikari::instantiateTemplate(L"cubeTemplate", context, object->getPosition(), object->getRotation());
		}

		wchar_t buff[200];
		swprintf(buff, L"FIXED FPS %d",fixedFps);
		text->setText(buff);
		fps++;
		int current=context->getCurrentTime();
		if((current-lastTime)>1000){
			lastTime=current;
			fixedFps=fps;
			fps=0;
		}
	}

	IMPLEMENT_RTTI(AnotherScript, BaseHikariScript);
};

BEGIN_REFLECTION_METADATA(AnotherScript, base_rtti_object)
END_REFLECTION_METADATA(AnotherScript)
#endif